﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Office.Interop.Excel;

namespace WFL.Office.Excel
{
    public class ExcelDialogSheet : DisposableSite, ISheet
    {
        internal DialogSheet _dialogSheet
        {
            get;
            private set;
        }

        internal ExcelDialogSheet(DialogSheet dialogSheet)
        {
            _dialogSheet = dialogSheet;
        }

        public void Select(object replace = null)
        {
            _dialogSheet.Select(replace ?? Type.Missing);
        }

        protected override void Dispose(bool disposing)
        {
            if (_dialogSheet != null)
            {
                if (disposing)
                {
                    Marshal.ReleaseComObject(_dialogSheet);
                }
                _dialogSheet = null;
                base.Dispose(disposing);
            }
        }
    }
}
